Public Class SQLParseAlterTable
    Inherits SQLParser

    Protected Overrides Function MyParserState() As SQLParserState
        Return SQLParserState.SQLParseAlterTable
    End Function

    Protected Friend Overrides Sub ParseCommands(ByVal Commands() As String, ByRef tables As TableList)
        If Commands.Length < 3 Then Return
        If Commands(0).ToLower() = "alter" And Commands(1).ToLower() = "table" Then
            Dim newActiveTable As Table = tables(Commands(2))
            If Not newActiveTable Is Nothing Then
                If Commands.Length > 9 AndAlso Commands(8).ToLower = "foreign" Then
                    Me.SetParserState(SQLParserState.SQLParseForeignKey)
                    Dim parser As New SQLParseForeignKey
                    parser.ParseCommands(Commands, tables)
                    Me.SetParserState(parser.GetParserState())
                Else
                    Me.SetParserState(SQLParserState.SQLParseAlterColumnDefinition)
                End If
            Else
                Me.SetParserState(SQLParserState.SQLParseNoTable)
            End If
            End If
    End Sub
End Class
